/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2019-07-04 11:34:12
 * @Description:
 *              首页-应用工具-APP评论新消息检索-详情-变更记录
 *              挖掘查询-详情-变更记录
 */
import { observable, action } from "mobx";
import resource from "@/utils/resource";
import API from "@/utils/api";

class APPIRChangeLogStore {
    @observable listData = [];

    @observable selectDate = [];
    @observable keyWords = "";
    @observable currentPage = 1;
    @observable type = "";

    @action.bound
    setNature(type, value, isGetData) {
        this[type] = value;
        if (isGetData) {
            this.getData();
        }
    }

    @action.bound
    changePage(newPage) {
        this.currentPage = newPage;
        this.getData();
    }

    @action.bound
    getData() {
        resource
            .get(API.excavateQueryChangeLogLists, {
                keyWords: this.keyWords,
                selectDate: this.selectDate,
                currentPage: this.currentPage,
                type: this.type
            })
            .then(res => {
                this.listData = res;
            });
    }
}

export default new APPIRChangeLogStore();
